package net.yb.util;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * JDBC工具类
 */
public class JdbcUtil {

    /**
     * 获取连接Connection
     */
    public static Connection getConnection() {
        // 1.加载驱动类
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            // 2.获取连接
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/yc12507?&serverTimezone=Asia/Shanghai", "root", "root");
            return conn;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
